/*
 * @Date: 2024-11-04 10:37:47
 * @Author: LiSong
 * @LastEditors: LiSong
 * @LastEditTime: 2024-11-04 10:45:33
 * @Description: 按钮类型
 */
import { PojoUtils } from '../cfg/PojoUtils'


/**
 * 按钮类型定义
 */
export class ButtonType {
  constructor (label, value) {
    this.label=label
    this.value=value
  }

  static get DEFAULT() {
    return new ButtonType('default', 'default')
  }
  static get PRIMARY() {
    return new ButtonType('primary', 'primary')
  }
  static get SUCCESS() {
    return new ButtonType('success', 'success')
  }
  static get WARNING() {
    return new ButtonType('warning', 'warning')
  }
  static get DANGER() {
    return new ButtonType('danger', 'danger')
  }
  static get INFO() {
    return new ButtonType('info', 'info')
  }

}

/**
 * 按钮的类型数据集
 */
export class ButtonTypes {
  /**
   * 获取选框类型的数组
   * 
   * @returns {Array}
   */
  static getData () {
    const staticKeys = PojoUtils.getOwnPropertyStatics(ButtonType)
    const staticItems = staticKeys.map(key => ButtonType[key])
    return staticItems
  }
}